.\" Written by Rylie Pavlik <rylie@ryliepavlik.com> in mandoc format,
.\" based on the original help output from the meshlabserver program.
.Dd March 05, 2020
.Dt MESHLABSERVER 1
.Os
.Sh NAME
.Nm meshlabserver
.Nd The open source batch mesh processing system
.Sh SYNOPSIS
.Nm
.Op Fl d Ar output
.Nm
.Op Fl l Ar logfile
.Op Fl p Ar projectfile
.Op Fl w Ar outputprojectfile Op Fl x
.Oo Fl i Ar meshfile Oc ...
.Oo
.Fl o Ar outfile
.Op Fl l Ar opt_layer
.Op Fl m Ar opt_mask
.Oc
.Op Fl s Ar scriptfile
.Sh DESCRIPTION
.Nm
allows batch-processing usage of functionality available in the interactive
.Xr meshlab 1
application.
.Pp
The arguments are as follows:
.Bl -tag -width Ds
.It Fl d Ar output
dump on a text file a list of all the filtering functions
.It Fl l Ar logfile
log of the filters is output on a file
.It Fl p Ar projectfile
meshlab project ( .mlp ) to be loaded
.It Fl w Ar outputprojectfile Op Fl x
output meshlab project (.mlp) to be saved.
If
.Fl x
flag is specified, any 3D model file(s)
.Pa meshfile.ext
contained in the input project will be overwritten.
Otherwise, for an input filename of
.Pa meshfile.ext ,
the model will be saved in the same directory of
input mesh as a new file called
.Pa meshfile_out.ext .
ALL the mesh attributes will be exported in the saved files.
.It Fl i Ar file
mesh that has to be loaded
.It Fl o Ar outfile Oo Fl l Ar opt_layer Oc Oo Fl m Ar opt_mask Oc
the name of the file where to write the current layer of the project.
.Bl -tag -width Ds
.It Fl l Ar opt_layer
Save the specified layer to the chosen filename. Valid values for
.Ar opt_layer
can be
.Bl -tag -width Ds
.It A number in the range [0, last_layer_in_the_project]
to indicate the desired layer by its index.
.It Ql c
indicate the CURRENT layer in the project
.It Ql x
indicate the LAST layer in the project
.El
.It Fl m Ar opt_mask
the listed mesh attributes will be saved in the output file.
The parameter
.Ar opt_mask
can be a space-separated list of the following attributes:
.Bl -tag -width Ds
.It Ql vc
vertex colors
.It Ql vf
vertex flags
.It Ql vq
vertex quality
.It Ql vn
vertex normals
.It Ql vt
vertex texture coords
.It Ql vr
vertex radius
.It Ql fc
face colors
.It Ql ff
face flags
.It Ql fq
face quality
.It Ql fn
face normals
.It Ql wc
wedge colors
.It Ql wn
wedge normals
.It Ql wt
wedge texture coords
.It Ql mp
polygonal mesh info
.It Ql sa
save in ascii format
.El
.El
.It Fl s Ar scriptfile
the script to be applied.
Must be in the xml format saved by MeshLab.
.El
.Pp
.Sh NOTES
There can be multiple meshes loaded and the order they are listed matters
because filters that use meshes as parameters choose the mesh based on the
order.
.Pp
The format of the output mesh is guessed by the used extension.
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
Apply the script contained in the file
.Pa meshclean.mlx
to the mesh contained in
.Pa input.obj .
Save the per-vertex-color, the per-face-quality, and the per-wedge-texture attributes
contained in the current layer into
.Pa output.ply .
.Dl $ meshlabserver -i input.obj -o output.ply -m vc fq wt -s meshclean.mlx
.Pp
Apply the script contained in the file
.Pa meshclean.mlx
to the mesh contained in
.Pa input.obj .
Save the per-vertex-color, the per-face-quality and the per-wedge-texture attributes contained in the layer 2
(if it exists!) into
.Pa output.ply .
Save the last layer of the project to
.Pa output_last
with the default geometric attributes.
.Dl $ meshlabserver -i input.obj -o output.ply -l 2 -m vc fq wt -o output_last.ply -l l -s meshclean.mlx
.Pp
Apply the script contained in the file
.Pa meshclean.mlx
to the mesh composed of
.Pa input0.obj
and
.Pa input1.ply .
Make
.Pa input1.ply
the current mesh of the project (i.e. the mesh to which the filters operating on a single model will be applied).
Generate a new output project
.Pa outproj.mlp
containing references to
.Pa input0.obj
and
.Pa input1.ply .
The files
.Pa input0.obj
and
.Pa input1.ply
will be overwritten.
A log will be written to
.Pa logfile.txt .
.Dl $ meshlabserver -l logfile.txt -p proj.mlp -i input.obj -w outproj.mlp -s meshclean.mlx
.Sh SEE ALSO
.Xr meshlab 1
.Sh AUTHOR
Paolo Cignoni - Visual Computing Lab - ISTI - CNR
